package com.isoftstone.guodian.purApproval.control;

import com.isoftstone.guodian.demo.service.TFultbpurchasingapplyService;
import com.isoftstone.guodian.entity.TFultbpurchasingapplyEntity;
import com.isoftstone.guodian.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class TFultbpurchasingapplyControl4 {
    @Autowired
    private TFultbpurchasingapplyService tfultbpurchasingapplyService;
    @RequestMapping("/hatee")
    public String updateEmpLifultbpurchasingapply2(String id,Integer pageNow, Model model) throws Exception {
        TFultbpurchasingapplyEntity entity = tfultbpurchasingapplyService.selectById(id);
        entity.setExecutestate("审批通过");
        tfultbpurchasingapplyService.updateEntity(entity);

        try {
            PageUtils page = new PageUtils();
            if (pageNow == null) {
                pageNow = 1;
            }
            page.setPageNow(pageNow);
            page.setTotal(tfultbpurchasingapplyService.selectTotal(null));
            entity.setPageUtils(page);
            List<TFultbpurchasingapplyEntity> list = tfultbpurchasingapplyService.selectForPage(entity);
            /*System.out.println(list.get(0));*/
            model.addAttribute("rows", list);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return "/demo/demo_cgsqsp.jsp";
    }
}
